var status = -1;
var level = "02";
var header = "#fn黑体##fs32#B - " + level + " F\r\n\r\n";

function action(e, d, c) {
    status++;
    var b = cm.getEventManager("副本_起源之塔");
    var f = b == null ? null : b.getProperty("stage" + parseInt(level));
    if (f != null && f.equals("start")) {
        cm.dispose();
        return
    }
    if (cm.getInfoQuest(42001).contains("noHelp=1")) {
        startMap(b);
        return
    }
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.curNodeEventEnd(true);
            cm.setInGameDirectionMode(true, false);
            cm.setStandAloneMode(true);
            cm.inGameDirectionEvent_AskAnswerTime(30)
        } else {
            if (status === a++) {
                cm.fieldEffect_InsertCanvas(1, 128, 0, 0, 0, 1000, 0);
                cm.inGameDirectionEvent_AskAnswerTime(1000)
            } else {
                if (status === a++) {
                    cm.inGameDirectionEvent_Monologue(header + "#fs20#啊，这个结界是？！", 0)
                } else {
                    if (status === a++) {
                        cm.inGameDirectionEvent_Monologue("新的结界，想要突破这个结界，就得从白狼或者野狼那里获得比各个封印更高的数字。", 0)
                    } else {
                        if (status === a++) {
                            cm.inGameDirectionEvent_Monologue("如果获得了卡片，就前往要欺骗的结界，按上方向键。", 1)
                        } else {
                            if (status === a++) {
                                cm.fieldEffect_InsertCanvas(0, 0, 0, 0, 1000, 0, 0);
                                cm.curNodeEventEnd(true);
                                cm.setInGameDirectionMode(false, true);
                                cm.setStandAloneMode(false);
                                startMap(b)
                            } else {
                                cm.dispose()
                            }
                        }
                    }
                }
            }
        }
    }
}

function startMap(a) {
    cm.dispose();
    cm.updateHeaderUI(1, 2, cm.getEventInstance().getTimeLeft(), 0, cm.getEventInstance().getTimeLeft(), 42011);
    a.setProperty("stage" + parseInt(level), "start");
    var b = cm.getMap().getPortal(1).getPosition();
    cm.onTeleport(1, cm.getPlayer().getId(), b.getX(), b.getY());
    cm.fieldEffect_ScreenMsg("UI/UIWindowPL.img/HiddenCatch/StageImg/start");
    cm.getMap().getWeatherEffectNotice("必须捕捉怪物获得数字高于结界的卡片后，才能欺骗结界。", 147, 60000, 1);
    cm.updateInfoQuest(42006, "yc=0;b=0;g=0;bc=0;gc=0;r=0;y=0;rc=0");
    cm.getMap().getReactorByName("r").forceHitReactor(cm.getPlayer(), cm.rand(0, 4));
    cm.getMap().getReactorByName("g").forceHitReactor(cm.getPlayer(), cm.rand(0, 4));
    cm.getMap().getReactorByName("b").forceHitReactor(cm.getPlayer(), cm.rand(0, 4));
    cm.getMap().getReactorByName("y").forceHitReactor(cm.getPlayer(), cm.rand(0, 4))
}

function start() {
    status = -1;
    action(1, 0, 0)
};